<template>
  <div>
    <el-card>
      <h1 style="font-weight:700;font-size:24px">小区建档</h1>
      <el-divider></el-divider>
      <div v-show="sta == true" style="margin-top: 50px;">
        <h2 style="text-align: center;font-size: 35px;margin-bottom: 50px;">xx区 小区信息统计</h2>
        <el-table :data="list" border style="width: 100%">
          <el-table-column prop="name" label="小区名" width="180">
          </el-table-column>
          <el-table-column prop="address" label="小区地址" width="180">
          </el-table-column>
          <el-table-column prop="kfs" label="小区开发商" width="180">
          </el-table-column>
          <el-table-column prop="wuye" label="小区物业" width="180">
          </el-table-column>
          <el-table-column prop="cz" label="操作">
            <template slot-scope="scope">
              <el-button style="background-color: #394E9E;color:white" @click="bianji(scope.row)">编辑</el-button>
              <el-button style="background-color: #394E9E;color:white" @click="xiangqing">详情</el-button>
              <el-button v-show="scope.row._id != '65f113c2fb93ebaa77359cd2'">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div v-show="sta == false">
        <el-button @click="sta = true">返回上一级</el-button>

      </div>


      <el-dialog title="添加" :visible.sync="tjsta">
        <el-form :model="xiaoquform">
          <el-form-item label="小区名" :label-width="formLabelWidth">
            <el-input v-model="xiaoquform.name" autocomplete="off"></el-input>
          </el-form-item>
          <el-form-item label="地址" :label-width="formLabelWidth">
            <el-input v-model="xiaoquform.address" autocomplete="off"></el-input>
          </el-form-item>
          <el-form-item label="开发商" :label-width="formLabelWidth">
            <el-input v-model="xiaoquform.kfs" autocomplete="off"></el-input>
          </el-form-item>
          <el-form-item label="物业" :label-width="formLabelWidth">
            <el-input v-model="xiaoquform.wuye" autocomplete="off"></el-input>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="tjsta = false">取 消</el-button>
          <el-button style="background-color: #394E9E;color:white" @click="add">确 定</el-button>
        </div>
      </el-dialog>



    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: [],
      sta: true,
      xiaoquform: {
        name: '',
        address: '',
        kfs: '',
        wuye: '',
      },
      tjsta: false,
      formLabelWidth: '120px',
    }
  },
  methods: {
    async getdata() {
      let { data } = await this.axios.get('/xiaoqulist',)
      this.list = data.list
    },
    xiangqing() {
      this.sta = false
    },
    add() {
      this.tjsta = false
    },
  },
  mounted() {
    this.getdata()
  },
  computed: {
    currentTime() {
      return new Date().toLocaleString();
    }
  },
  created() {
  },
}
</script>

<style>

</style>